<script lang="ts" setup>
  import headerSearch from '@/components/headerSearch.vue'
  import musicList from '@/components/musicList.vue'

  interface Artist {
    alias: any | string[];
    id: number;
    name: string;
    tns: any | string[];
  }

  interface Album {
    id: number;
    name: string;
    pic: number;
    picUrl: string;
    pic_str: string;
    tns: any | string[];
  }

  interface SearchResult {
    al: Album;
    ar: Artist[];
    cd: string;
    id: number;
    mark: number;
    name: string;
    publishTime: number;
  }

  const searchResult = ref<SearchResult[]>([
    {
      al: {
        id: 0,
        name: '',
        pic: 0,
        picUrl: '',
        pic_str: '',
        tns: [''],
      },
      ar: [
        {
          alias: [''],
          id: 0,
          name: '',
          tns: [''],
        },
      ],
      cd: '',
      id: 0,
      mark: 0,
      name: '',
      publishTime: 0,
    },
  ])

  const modelValue = (result: SearchResult[]) => {
    searchResult.value = result
  }
</script>

<template>
  <v-app class="app">
    <header-search router-path="/search" @update:model-value="modelValue" />
    <div class="container">
      <music-list v-if="searchResult.length>1" class="searchResult" :search-result="searchResult" />
      <div v-else class="musicList">
        榜单项
      </div>
    </div>
  </v-app>
</template>

<style lang="scss" scoped>
.container{
  padding: 0 16px;
  margin-top: 55px;
  height: calc(100vh - 55px);
}
:deep(.v-app-bar.v-toolbar) {
  background: #f8f9fd;
}
</style>
